home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Yerk 3.64 / Supplement / Unsupported / Utilities / PrintAll < prev    next >
Text File  |  1986-10-17  |  1KB  |  57 lines

  1. \ printall -- prints all text files on a volume
  2. \  1/23/85  SSG Version 1.0
  3. \  2/12/85  SSG Prints files in alphabetical order
  4. \  2/15/85  SSG Made filenames case insensitive
  5. \  1/07/86  cdn Integrated with qPrint
  6. Decimal
  7.  
  8. // vol
  9. // iwCtl
  10.  
  11. SCON SYSNAME "System"
  12.  
  13. 100 ordered-col FNames         \ to contain indices of filenames
  14. 0 variable tempFN  60 allot    \ filename buffer
  15. : .st sp@ s0 swap 624 count type (.stack) ;
  16. \ ( addr -- )   Converts a str255-format string to uppercase.
  17. : >ucStr255
  18.     count swap +base swap >uc ;
  19.  
  20. \ Compares two filenames.
  21. : FnComp  { e1 e2 -- result }
  22.     e2 getidxfile drop pad tempFN 64 cmove
  23.     e1 getidxfile drop
  24.     pad        >ucStr255
  25.     tempFN    >ucStr255
  26.     pad count tempFN count $= ;
  27.  
  28. \ Sorts indices of filenames in FNames.
  29. : getFNs    
  30.     CR ." Reading/Sorting disk directory… "
  31.     filecount 0 DO i 1+ add: FNames LOOP
  32.     ixAddr: FNames size: FNames 'c FnComp sort ;
  33.  
  34. \ ( -- )  Prints all text files on the default volume.                            
  35. : printAll  pinit 
  36.     picaProp                     \ Set font to Pica proportional .
  37.     new: loadFile
  38.     getFNs
  39.     size: FNames 0
  40.     DO    i at: FNames getidxfile
  41.         pad count sysname s= not                 \ file = System ?
  42.         IF    clear: topFile
  43.             pad count name: topFile
  44.             openReadOnly: topFile ?error 132
  45.             GetFileInfo: topFile  drop
  46.             GetType: topFile txType = 
  47.             IF    CR ." Printing: " pad count type
  48.                 qPrint
  49.             THEN
  50.             close: topFile drop
  51.         THEN
  52.     LOOP
  53.     remove: loadFile ;
  54.  
  55. : printext   external printall ;
  56. : printint   sony printall ;
  57.